Non-volatile memory devices, such as flash memory, are widely used in data storage applications. Although the physical characteristics of flash memory allow for non-volatile data storage, flash memory has the disadvantage of having a finite lifespan. For instance, NAND flash memory blocks typically wear out or fail after undergoing approximately 100,000 to 1,000,000 write operations.
A flash driver typically performs memory operations, e.g., read, write, and erase operations, on memory blocks. During write operations the flash driver is commonly required to identify erased memory blocks available to store data. Many flash drivers perform these write operations on the most recently erased memory block. Although this method efficiently locates erased memory blocks for performing write operations, it does not always evenly distribute write operations among the memory blocks and thus decreases the life of the flash memory.
To maximize the lifespan of flash memory, many systems implement wear-leveling techniques that attempt to more evenly appropriate write operations over the memory blocks. For instance, flash drivers may increase wear-leveling by linearly searching a logical-to-physical table that provides pointers to all of the memory blocks in flash memory. There are typically flags accompanying the pointers in the logical-to-physical table, for example, an erase flag to indicate that the memory block corresponding to the pointer is erased and a bad block flag to indicate that the memory block has failed.
Although this wear-leveling technique may increase the lifespan of the flash memory by distributing the write operations, the linear search of the logical-to-physical table used to find the next erased block to write data is inefficient and, in some circumstances, impossible to perform given the processing requirements of the flash driver. For instance, a flash driver performing a linear search on a logical-to-physical table having 1024 memory blocks with 24 available and erased memory blocks, requires an average of 44 accesses to the logical-to-physical table to find an erased memory block, with a worst-case scenario of 1000 accesses to the logical-to-physical table. When the flash memory includes 10 bad memory blocks and only 14 erased memory blocks, the flash driver will have to access the logical-to-physical table an average of 77 times to find an erased block.